package pages;

import core.TestBase;
import org.openqa.selenium.By;
import org.testng.Assert;
import ui_test.TestData;
import utils.Log4Test;

/**
 * Created with IntelliJ IDEA.
 * User: u
 * Date: 7/20/14
 * Time: 10:24 PM
 * To change this template use File | Settings | File Templates.
 */
public class UserSettingsPage extends GeneralPage {
    protected By userMail = By.xpath(".//div[contains(text(),'Электронная почтa')]/../div[@class='field']");
    protected By userName = By.xpath(".//div[contains(text(),'Ваше имя')]/../div[@class='field']");
    protected By settingaTitle = By.xpath(".//h1[@class='personal-info-title']");
    protected By settingsEditLink = By.xpath("//*[@id=\"edit_profile\"]");
    
    public void verifysettingsTitle() {
        Log4Test.info("Verify settings page title");
        Assert.assertTrue(webDriver.findElement(settingaTitle).getText().equals("Мои настройки"));
    }
                                     
    public void verifyUserMailAndName() {
        Log4Test.info("Verify user name and email");
        Assert.assertTrue(webDriver.findElement(userMail).getText().equals(TestData.email));
        Assert.assertTrue(webDriver.findElement(userName).getText().equals(TestData.userName));
    }

    public EditPage editPageClick() {
        Log4Test.info("To edit page click");
        webDriver.findElement(settingsEditLink).click();
        return new EditPage();
    }
}
                                                                                                       